import {db} from "@common/database/db";

export const SysOperLogDao = {
    async create(data: Partial<SysOperLog>): Promise<any> {
        const result = await db.insertInto('sys_oper_log').values(data as any).executeTakeFirst();
        return Number((result as any).insertId);
    },
    async list(): Promise<SysOperLog[]> {
        const result = await db.selectFrom('sys_oper_log').selectAll().execute();
        return result as any;
    },
    async delete(oper_id: number): Promise<any> {
        const result = await db.deleteFrom('sys_oper_log').where('oper_id', '=', oper_id).executeTakeFirst();
        return Number((result as any).numDeletedRows);
    }
}